<template>
  <el-dialog width="40%" top="25vh" :title="$t('m.stock.warning')" append-to-body :visible.sync="popupVisible" :before-close="close">
    <!-- tool start -->
    <el-form align="left" ref="form" :model="detail" :rules="ruleForm" label-width="120px">
      <el-row>
        <el-col :span="20">
          <el-form-item :label="$t('m.stock.storageupper')" prop="maxStock">
            <el-input maxlength="20" show-word-limit v-model="detail.maxStock"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="20">
          <el-form-item :label="$t('m.stock.storagelower')" prop="minStock">
            <el-input maxlength="20" show-word-limit v-model="detail.minStock"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24" align="center">
          <p class="tips">{{$t('m.stock.tip')}}</p>
        </el-col>
      </el-row>
    </el-form>
    <!-- tool end -->
    <el-row>
      <el-col :span="24" align="center">
        <el-button type="primary" @click="save">{{$t('m.save')}}</el-button>
        <el-button @click="close">{{$t('m.close')}}</el-button>
      </el-col>
    </el-row>
  </el-dialog>
</template>
<script>
import {formValidate} from '@/assets/mixins/rule/product-inventory-validate'
export default {
  name:'setting-warning-popup',
  props:['popupVisible'],
  mixins:[formValidate],
  data(){
    return {
      detail:{
        maxStock:0,
        minStock:0
      }
    }
  },
  mounted(){

  },
  methods:{
    close(){
      this.$emit('close')
    },
    save(){
      if(this.detail.maxStock<this.detail.minStock) return this.callbackMessage('库存上限不能小于库存下限')
      this.$emit('save',this.detail)
    }
  }
}
</script>
<style lang="scss" scoped>
.tips{color: #F56C6C; margin-bottom: 22px;}
</style>